package com.haiyan.demo11_this关键字;

public class Student {
    private String name;
    private int age;
    public void setName(String name)
    {
        this.name=name;
    }
    public void setAge(int age)
    {
        if(age<0 || age>150)
        {
            System.out.println("数据不合法");
            this.age=-1;
        }
        else{
            this.age=age;
        }
    }
    public String getName()
    {
        return this.name;
    }
    public int getAge()
    {
        return this.age;
    }
}
